package com.itheima.sms.consumer;

import com.itheima.sms.common.MqConst;
import com.itheima.sms.mqtask.SmsSendTask;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(topic = MqConst.SMS_SEND_TOPIC,consumerGroup = "SMS-SEND_GROUP")
@Slf4j
public class SmsSendConsumer implements RocketMQListener<SmsSendTask> {
    @Override
    public void onMessage(SmsSendTask message) {
      log.info("[发送短信消费者]收到消息：{}",message);
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //调用第三方服务发送短信
        log.info("[发送短信消费者]开始调用阿里云发送。。");
    }
}
